package com.company.libraryservice.common;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 统一返回体
 *
 * @author RoyMa
 * @date 2025-08-14
 */
@Data
@AllArgsConstructor
public class ApiResp<T> {
  private int code;
  private String msg;
  private T data;

  public static <T> ApiResp<T> ok(T data) {
    return new ApiResp<>(0, "success", data);
  }

  public static ApiResp<Void> fail(String msg) {
    return new ApiResp<>(1, msg, null);
  }
}
